home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / MWCC03 / EXAMPLES.ZIP / MWCCWIN.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-18  |  5KB  |  162 lines

  1. {**********************************************************************}
  2. {*                                                                    *}
  3. {*          Microworks Sample Application                                        *}
  4. {*                                                                    *}
  5. {*         for Borland Pascal v7.0 and Turbo Pascal for Windows v1.5           *}
  6. {*                                                                    *}
  7. {*     Copyright 1992-93 Jeff Franks (Microworks) Sydney, Australia.  *}
  8. {*                                                                    *}
  9. {*         You are free to use, modify, reproduce and distribute the      *}
  10. {*         Sample Files (and/or any modified version) in any way you      *}
  11. {*         find useful.                                                                *}
  12. {*                                                                    *}
  13. {**********************************************************************}
  14.  
  15. {*** Introduction
  16.  
  17.     Application    := Basic MWCC Window
  18.  
  19.     Files          := MWCCWin.pas
  20.  
  21.     Units Required := MObjects and MWCC.dll
  22.  
  23.     Tabs           := 2
  24.  
  25.     Screen         := 800 * 600
  26.  
  27.     Date           := August, 1993.
  28.  
  29.     The TMWCCWindow object is a very versatile window. The least thing it does is draw
  30.     a raised border around the client area. By changing the bitmap name or the boolean
  31.     values in the InitMainWindow method you can give the client area a BWCC or MWCC
  32.     pattern, add an SFX style frame or prevent the window from being resized. If you
  33.     don't plan to add an SFX style frame you could either use ws_EX_DlgModalFrame
  34.     (Attr.ExStyle) or not use a frame at all.
  35.  
  36.     Warning - Don't overide any inherited methods (not listed here) without first consulting
  37.               the documentation.
  38.  
  39. ***}
  40.  
  41. program MWCCWin;
  42.  
  43. uses WinTypes, WinProcs, MObjects,
  44.          {$IFDEF Ver15}
  45.              WObjects;
  46.          {$ELSE}
  47.              Objects, OWindows, ODialogs;
  48.          {$ENDIF}
  49.  
  50. const
  51.  
  52.     AppName : PChar = 'NewMWCCWindow';
  53.  
  54. type
  55.  
  56.     PNewMWCCApplication = ^TNewMWCCApplication;
  57.     TNewMWCCApplication = object(TApplication)
  58.         procedure InitMainWindow; virtual;
  59.     end;
  60.  
  61.     PNewMWCCWindow = ^TNewMWCCWindow;
  62.     TNewMWCCWindow = object(TMWCCWindow)
  63.         constructor Init(AParent: PWindowsObject; AName, ABmp: PChar);
  64.       destructor Done; virtual;
  65.         function  GetClassName : PChar; virtual;
  66.         procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  67.         procedure SetUpWindow; virtual;
  68.         procedure WMCtlColor (var Msg: TMessage); virtual wm_First + wm_CtlColor;
  69.         procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
  70.         procedure WMNCPaint (var Msg: TMessage); virtual wm_First + wm_NCPaint;
  71.         procedure WMActivate (var Msg: TMessage); virtual wm_First + wm_Activate;
  72.         procedure WMNCActivate (var Msg: TMessage); virtual wm_First + wm_NCActivate;
  73.         procedure WMActivateApp (var Msg: TMessage); virtual wm_First + wm_ActivateApp;
  74.         procedure WMGetMinMaxInfo (var Msg: TMessage); virtual wm_First + wm_GetMinMaxInfo;
  75.     end;
  76.  
  77. {********** TNewMWCCApplication **********}
  78.  
  79. procedure TNewMWCCApplication.InitMainWindow;
  80. begin
  81.     MainWindow := New(PNewMWCCWindow, Init(nil, 'MWCC Window', nil));
  82. end;
  83.  
  84. {********** TNewMWCCWindow **********}
  85.  
  86. constructor TNewMWCCWindow.Init(AParent: PWindowsObject; AName, ABmp: PChar);
  87. begin
  88.     TMWCCWindow.Init(AParent, AName, ABmp);
  89.     Attr.Style := Attr.Style;
  90.     Attr.X := GetSystemMetrics(sm_CXScreen) div 4;
  91.     Attr.Y := (GetSystemMetrics(sm_CYScreen) div 4);
  92.     Attr.W := GetSystemMetrics(sm_CXScreen) div 2;
  93.     Attr.H := (GetSystemMetrics(sm_CYScreen) div 2);
  94.   {IsSizeable := False;}
  95.   {SFXFrame := True;}
  96. end;
  97.  
  98. destructor TNewMWCCWindow.Done;
  99. begin
  100.     TMWCCWindow.Done;
  101. end;
  102.  
  103. function TNewMWCCWindow.GetClassName;
  104. begin
  105.   GetClassName := AppName;
  106. end;
  107.  
  108. procedure TNewMWCCWindow.GetWindowClass (var AWndClass: TWndClass);
  109. begin
  110.     TMWCCWindow.GetWindowClass(AWndClass);
  111. end;
  112.  
  113. procedure TNewMWCCWindow.SetUpWindow;
  114. begin
  115.     TMWCCWindow.SetUpWindow;
  116. end;
  117.  
  118. procedure TNewMWCCWindow.WMCtlColor (var Msg: TMessage);
  119. begin
  120.     TMWCCWindow.WMCtlColor(Msg);
  121. end;
  122.  
  123. procedure TNewMWCCWindow.WMPaint (var Msg: TMessage);
  124. begin
  125.     TMWCCWindow.WMPaint(Msg);
  126. end;
  127.  
  128. procedure TNewMWCCWindow.WMNCPaint (var Msg: TMessage);
  129. begin
  130.     TMWCCWindow.WMNCPaint(Msg);
  131. end;
  132.  
  133. procedure TNewMWCCWindow.WMActivate (var Msg: TMessage);
  134. begin
  135.     TMWCCWindow.WMActivate(Msg);
  136. end;
  137.  
  138. procedure TNewMWCCWindow.WMNCActivate (var Msg: TMessage);
  139. begin
  140.     TMWCCWindow.WMNCActivate(Msg);
  141. end;
  142.  
  143. procedure TNewMWCCWindow.WMActivateApp (var Msg: TMessage);
  144. begin
  145.     TMWCCWindow.WMActivateApp(Msg);
  146. end;
  147.  
  148. procedure TNewMWCCWindow.WMGetMinMaxInfo (var Msg: TMessage);
  149. begin
  150.     TMWCCWindow.WMGetMinMaxInfo(Msg);
  151. end;
  152.  
  153. {********** Main program **********}
  154.  
  155. var
  156.     MWCCApp: TNewMWCCApplication;
  157. begin
  158.   MWCCApp.Init(AppName);
  159.   MWCCApp.Run;
  160.   MWCCApp.Done;
  161. end.
  162.